package com.china.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.china.osourcechina.R;

import java.util.List;

/**
 * Created by Administrator on 2016/5/13.
 */
public class EmojiAdapter extends BaseAdapter {

    private List<Integer> list;
    private Context context;

    public EmojiAdapter(List<Integer> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = LayoutInflater.from(context).inflate(R.layout.activity_tweet_emoji_item,null);

        ImageView iv_tweet_emoji_item_img = (ImageView)convertView.findViewById(R.id.iv_tweet_emoji_item_img);

        iv_tweet_emoji_item_img.setImageResource(list.get(position));

        return convertView;
    }
}
